#include <func.h>

int main()
{
    unsigned short port=0x1234;
    unsigned short nport;
    //htons将port的值从主机字节序转换为网络字节序
    nport=htons(port);
    printf("%x\n",nport);

    //ntohs将网络字节序转换为主机字节序
    printf("local %x\n",ntohs(nport));
    return 0;
}